#!/usr/bin/env node

const http=require('http'),
      log=console.log,
      url=require('url'),
      addr=process.argv[2];

http.get(addr,(res)=>{
  //let data='';

  //res.on('data',(chunck)=>{
    //data+=chunck;
  //});
  //res.on('end',()=>{
    //log(data);
  //});

  //print response start line
  //HTTP/1.1 200 OK
  log(`HTTP/${res.httpVersion}${res.statusCode} ${res.stausMessage}`);
  //print reponse headers
  //Content-length:22
  log(res.headers);
  //print response body
  res.pipe(process.stdout);
});
